#include<iostream>

int main()
{
    int i = 5, j =10;
    int *p = &i;//初始化p的指针指向i

    //p指的是对象的内存地址，p所指对象的值
    std::cout<<p<<" "<<*p<<std::endl;
    //指针p指向另一个对象j
    p = &j;
    std::cout<<p<<" "<<*p<<std::endl;
    //显示更改指针p的值
    *p = 20;
    std::cout<<p<<" "<<*p<<std::endl;
    j = 30;
    std::cout<<p<<" "<<*p<<std::endl;
    return 0;

}
